home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / MPW / MPW dmake 4.0 / dbug / dbug.mk next >
Encoding:
Text File  |  1995-09-18  |  1.9 KB  |  69 lines  |  [TEXT/MPS ]

  1. # Set the proper macros based on whether we are making the debugging version
  2. # or not.  The valid parameters to this file are:
  3. #
  4. #    DEBUG=1        ==> enable the making of the DBUG version
  5. #    DBMALLOC=1    ==> enable DBUG version with extensive MALLOC checking
  6. #
  7. #    DB_CFLAGS    ==> CFLAGS is set to this value at the end if DEBUG=1
  8. #    DB_LDFLAGS    ==> LDFLAGS is set to this at the end if DEBUG=1
  9. #    DB_LDLIBS       ==> LDLIBS is set to this at end if DEBUG=1
  10. #
  11. # The non debug versions of the above three macros are:
  12. #
  13. #    NDB_CFLAGS
  14. #    NDB_LDFLAGS
  15. #    NDB_LDLIBS
  16. #
  17. # One of the set of three should have values set appropriately prior to
  18. # sourcing this file.
  19.  
  20. .IF $(DEBUG)
  21.    DBUG_SRC    += dbug.c
  22. .IF $(OS) != mac
  23.    DB_CFLAGS    += -Idbug/dbug
  24. .ENDIF
  25.  
  26.    .SETDIR=dbug/dbug : $(DBUG_SRC)
  27.  
  28.    # If DBMALLOC is requested (ie non-NULL) then include the sources for
  29.    # compilation.  BSD 4.3 needs the getwd.c source compiled in due to a bug
  30.    # in the clib getwd routine.
  31.    .IF $(DBMALLOC)
  32.       # Serious bug in bsd43 getwd.c would free a string and then use its
  33.       # value.  The DBMALLOC code clears a string when it is free'd so the
  34.       # value was no longer valid and the returned path for the current
  35.       # directory was now completely wrong.
  36.       .IF $(OSRELEASE) == bsd43
  37.      GETWD_SRC += getwd.c
  38.      .SETDIR=dbug : $(GETWD_SRC)
  39.       .END
  40.  
  41.       MLC_SRC   += malloc.c free.c realloc.c calloc.c string.c\
  42.            mlc_chk.c mlc_chn.c memory.c tostring.c m_perror.c\
  43.            m_init.c mallopt.c dump.c
  44.  
  45.       .SETDIR=dbug/malloc : $(MLC_SRC)
  46.  
  47.       DB_CFLAGS += -Idbug/malloc
  48.    .END
  49.  
  50.    SRC          += $(DBUG_SRC) $(MLC_SRC) $(GETWD_SRC)
  51.    HDR        += db.h 
  52.  
  53.    LDFLAGS    += $(DB_LDFLAGS)
  54.    LDLIBS    += $(DB_LDLIBS)
  55.  
  56.    __.SILENT    !:= $(.SILENT)
  57.    .SILENT    !:= yes
  58.    TARGET    := db$(TARGET)
  59.    OBJDIR    := $(OBJDIR).dbg
  60.    .SILENT    !:= $(__.SILENT)
  61.  
  62.    CFLAGS    += $(DB_CFLAGS)
  63.    .KEEP_STATE  := _dbstate.mk
  64. .ELSE
  65.    CFLAGS       += $(NDB_CFLAGS)
  66.    LDFLAGS      += $(NDB_LDFLAGS)
  67.    LDLIBS       += $(NDB_LDLIBS)
  68. .END
  69.